package com.jl15988.chainlog.example;

import com.jl15988.chainlog.annotation.ChainMethod;
import org.springframework.stereotype.Repository;

import java.util.UUID;

/**
 * 示例数据访问层
 */
@Repository
public class ExampleRepository {

    @ChainMethod(name = "保存数据", desc = "保存数据到数据库")
    public void saveData(String data) {
        // 模拟数据库保存
        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }

    @ChainMethod(name = "保存订单", desc = "保存订单到数据库")
    public String saveOrder(String orderData) {
        // 模拟订单保存
        try {
            Thread.sleep(40);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        return UUID.randomUUID().toString();
    }
}